package com.homework.exam02.Event;/*
 *@Author: helen
 *@Date:   2021/4/17 23:17
 *@Description:
 */

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class NoticeListener02 implements ApplicationListener<ApplicationReadyEvent> {

    private static final Logger logger = LoggerFactory.getLogger(NoticeListener02.class);
    @Override
    public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
        logger.info("ApplicationReadyEvent 事件监听器获取信息");
        ConfigurableApplicationContext applicationContext = applicationReadyEvent.getApplicationContext();
        System.out.println(applicationContext);
        logger.info("获取成功！");
    }
}
